﻿@model IEnumerable<WebVideo.EntityVideo>
@{ 
    if(@Model.Count() != 0)
    {
				if (System.Web.HttpContext.Current.Request.Cookies["userId"] != null)
				{
					int i = 0;
					foreach (var item in Model)
					{
                        string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                        string imgvs = "~/Content/Images/Video/" + item.Image;
						if (i == 0)
						{ 
							<div class="widget _2x2" style="overflow:hidden;">
							
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="305" height="305"/>
									</a>                    
							   <div class="description"> 
										<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
						}
						else
						{
							<div class="widget" style="overflow:hidden;">
				   
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="304" height="147"/>
									</a>   

						   
								<div class="description">
									<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
						}
						
						i++;
					}
					
				}
				else if (System.Web.HttpContext.Current.Request.Cookies["userId"] == null)
				{
					int i = 0;
					foreach (var item in Model)
					{
                        string imgct = "~/Content/Images/Avatar/" + item.EntityBusiness.Avatar;
                        string imgvs = "~/Content/Images/Video/" + item.Image;
						if (i == 0)
						{ 
							<div class="widget _2x2" id ="widget1" style="overflow:hidden;">
							
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="305" height="305"/>
									</a>                    
							   <div class="description"> 
										<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>      
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
						}
						else 
						{
							<div class="widget" id ="widget2" style="overflow:hidden;">
				   
									<a href="@Url.Action("NView", "Index", new { IdVideo = @item.Id })">
										<img src="@Url.Content(imgvs)" width="304" height="147"/>
									</a>   

						   
								<div class="description">
									<h2>@Html.ActionLink(@item.Name, "NView", new { IdVideo = @item.Id })</h2>
									<p class="vote _4">View: <span>@item.Viewed</span></p>
									<p class="company">
										<img src="@Url.Content(imgct)" /><span>@item.EntityBusiness.CompanyName</span>
									</p>
								</div>

								<!--/ description-->
							</div>
						}
						
						i++;
					}
					
					<script type="text/javascript">
					    $(document).ready(function () {
					        $('#widget1,#widget2,#widget3').click(function (e) {
					            e.preventDefault();
					            $('#frmLoginn, #widget _2x1').modal('show');
					        });
					    });</script>       
				}
				
    }
    else
    {
                    <div class="widget _3x1 phone bg-color-ForestGreen">
                    	<div class="widgetMsg">
                            <div class="pull-left"><img src="@Url.Content("~/Content/cssFrontEnd/images/icon-msg-success.png")" /></div>
                            <p>Chúc mừng bạn. <br />
                          Bạn đã xem hết video trong ngày hôm nay!</p>
                        </div>
                    </div><!--/ .widget-->
    }
 }